package com.chenwenxuan.sync.ui.tree;

import javax.swing.tree.DefaultMutableTreeNode;

import com.chenwenxuan.sync.console.model.Task;
import com.chenwenxuan.sync.console.model.TaskCatalog;

public class TaskTreeNode extends DefaultMutableTreeNode {

	private static final long serialVersionUID = -3286809220179233814L;
	
	public TaskTreeNode() {
		super();
	}

	public TaskTreeNode(Object userObject, boolean allowsChildren) {
		super(userObject, allowsChildren);
	}

	public TaskTreeNode(Object userObject) {
		super(userObject);
	}

	@Override
	public boolean isLeaf() {
		if ( userObject == null ){
			return super.isLeaf();
		}
		
		if ( userObject instanceof TaskCatalog ) {
			return false;
		}
		
		if ( userObject instanceof Task ) {
			return true;
		}
		
		return super.isLeaf();
	}

}
